写的比较潦草,欢迎指正….批评是我前进的动力……
/** * 顺序查找实现 Sequential Search */ public static function sequentialSearch(k:int, a:Array):int { var index:int = -1; for(var i:int = 0; i二分查找实现
/** * 二分查找实现 */ public static function binarySearch(k:int, a:Array):int { var startIndex:int = 0; var endIndex:int = a.length - 1; var midIndex:int; var index:int = -1; while(startIndex <= endIndex) { midIndex = int((startIndex + endIndex)/2); if(k > a[midIndex]) { startIndex = midIndex + 1; }else { endIndex = midIndex - 1; } if(k == a[midIndex]) { index = midIndex; } }//end of while return index; }//end of function binarySearchActionScript实现插入排序[直接插入排序 Insertion Sort],交互排序排序[单向双向冒泡排序 Bubble Sort] <->
Air中新建窗口 Create New Window In Air
// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.